package cn.itcast.job;

import org.quartz.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @program: schedule
 * @description: 配置类中, 将一些bean加入到工程中
 * @author: zhanghz001
 * @create: 2021-08-04 07:16
 **/
@Configuration
public class ZhzConfiguration {
    @Bean
    public JobDetail jobDetail3() {
        return JobBuilder
                .newJob(ZhzJob.class)
                .withIdentity("zhzJob", "group3")
                .storeDurably()
                .build();
    }
    
    @Bean
    public Trigger trigger3(JobDetail jobDetail3) {
        return TriggerBuilder.newTrigger()
                .withIdentity("trigger3", "group3")
                .startNow()
                .withSchedule(CronScheduleBuilder.cronSchedule("0/5 * * * * ?"))
                .forJob(jobDetail3)
                .build();
    }
}
